#include "CpuCycleCounter.h"


// #if Prozessor = Pentium

#define cpuid __asm __emit 0fh __asm __emit 0a2h

#define rdtsc __asm __emit 0fh __asm __emit 031h


void GetCpuCycleCounter(unsigned long &hi, unsigned long &lo)
	{
	unsigned long cycles_hi, cycles_lo;

	__asm {
		pushad
		cpuid
		rdtsc
		mov	cycles_hi, edx
		mov	cycles_lo, eax
		popad
		}
	hi = cycles_hi;
	lo = cycles_lo;
	}


unsigned long GetCpuCycleCounter()
	{
	unsigned long cycles_lo;

	__asm {
		pushad
		cpuid
		rdtsc
		mov	cycles_lo, eax
		popad
		}
	return cycles_lo;
	}

